package it.polito.let.pages;

import it.polito.let.http.*;

public class StandardPage extends Responder implements Page {

	private Request request;

	public StandardPage() throws HTTPError {
		super();
	}

	public void setRequest(Request r) {
		request = r;
	}

	@Override
	public Request getRequest() {
		return request;
	}

	public void handleRequest() throws HTTPError {
		switch (request.getRequestType()) {
		case GET:	
			super.returnFileByExtension(PagesConstants.ROOT + request.getRequestPath());
			break;
		default:
			throwHTTPError((short) 501, "Not Implemented");
		}
	}

}
